<template>
  <QfPage title="权限管理">
    <el-table :data="tableData">
      <el-table-column prop="id" label="id" />
      <el-table-column prop="uname" label="用户名" />
      <el-table-column>
        <template #default="{ row }">
          <el-button @click="openRoleDialog(row)">权限</el-button>
        </template>
      </el-table-column>
    </el-table>

    <el-drawer :size="600" v-model="showRoleDrawer" title="权限管理">
      <el-tree
        node-key="id"
        ref="roleTree"
        show-checkbox
        default-expand-all
        :data="roleData"
        :props="{ children: 'children', label: 'name' }"
      >
        <template #default="{ node, data }">
          <div class="mytree">
            <span>{{ data.name }}</span>
            <span class="actions">
              <addForTree :node="node" :nodedata="data" @created="getAllRole" />
              <el-link type="primary" @click="delRole(data.id)">删除</el-link>
            </span>
          </div>
        </template>
      </el-tree>
      <el-button @click="getAllNodes">获取全部选中的节点</el-button>
    </el-drawer>
  </QfPage>
</template>
<script setup lang="ts">
import { addCompany } from '@/api/rule'
</script>
<script lang="ts">
export default { name: 'rulePig' }
</script>
